<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>angularJs循环对象数组</title>
    <meta name="Copyright" content="All Rights Reserved"/>
    <link rel="shortcut icon" type="image/x-icon" href="itcast.ico"/>
    <link rel="stylesheet" type="text/css" href="base.css"/>
    <script src="js/angular.min.js"></script>
    <script type="text/javascript">

        /**
         * 定义模块
         */
        var myApp = angular.module("myApp",[]);

        /**
         * 模块中添加控制器
         */
        myApp.controller("myController",function ($scope) {
            /**
             * 定义对象数组
             */
            $scope.list  = [
                {name:"第一名",sex:"男",age:20},
                {name:"第二名",sex:"男",age:30},
                {name:"第三名",sex:"男",age:40}
            ]
        })
    </script>
</head>
<!-- 指定AngularJS应用的根元素 -->
<body ng-app="myApp" ng-controller="myController">
   <table border="1">
       <tr>
           <th>编号</th>
           <th>姓名</th>
           <th>性别</th>
           <th>年龄</th>
       </tr>
       <tr ng-repeat="u in list">
           <td>{{$index+1}}</td>
           <td>{{u.name}}</td>
           <td>{{u.sex}}</td>
           <td>{{u.sex}}</td>
       </tr>
   </table>
</body>
</html>